//package com.dly.blog.controller;
//
//import com.dly.blog.annotation.IgnoreAccess;
//import com.dly.blog.dao.ContentRepository;
//import com.dly.blog.domain.GptSessionContentElasticsearch;
//import com.dly.blog.msg.R;
//import com.dly.blog.service.TestService;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import jakarta.annotation.Resource;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.http.ResponseEntity;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.text.SimpleDateFormat;
//import java.time.LocalDateTime;
//import java.util.Date;
//import java.util.List;
//import java.util.Optional;
//
///**
// * @Author: DaiLiYu
// * @Date: 2023/7/11 13:23
// */
//@RestController
//@Tag(name = "测试接口")
//@Slf4j
//public class TestController extends BaseController{
//
//    @Resource
//    private TestService testService;
//
//    @Resource
//    private ContentRepository contentRepository;
//
//    @GetMapping("/test")
//    @Operation(summary = "普通测试请求")
//    @IgnoreAccess
//    public ResponseEntity<R<String>> test(){
//        return operate(()-> successDate(testService.getString("HHHH")));
//    }
//
//    @GetMapping("/test1")
//    @Operation(summary = "普通测试请求")
//    @IgnoreAccess
//    public ResponseEntity<R<Void>> test1(){
//        GptSessionContentElasticsearch gptSessionContentElasticsearch = new GptSessionContentElasticsearch();
//        gptSessionContentElasticsearch.setId(1104L);
//        gptSessionContentElasticsearch.setSessionId(111L);
//        gptSessionContentElasticsearch.setContent("你好");
//        gptSessionContentElasticsearch.setRole("user");
//        gptSessionContentElasticsearch.setChatType("Three");
//        gptSessionContentElasticsearch.setCreateTime(LocalDateTime.now());
//        gptSessionContentElasticsearch.setCreateUser(1L);
//        gptSessionContentElasticsearch.setUpdateTime(LocalDateTime.now());
//        gptSessionContentElasticsearch.setUpdateUser(1L);
//        gptSessionContentElasticsearch.setDeleted(0);
//        contentRepository.save(gptSessionContentElasticsearch);
//        Optional<GptSessionContentElasticsearch> byId = contentRepository.findById(1104L);
//        log.info("测试es的数据：{}", byId.get());
//        return operate(this::success);
//    }
//
//    @GetMapping("/query")
//    @Operation(summary = "搜索模块的查询")
//    @IgnoreAccess
//    public ResponseEntity<R<List<GptSessionContentElasticsearch>>> query(){
//        return operate(()-> R.ok(contentRepository.findByContentContainingOrderByCreateTimeDesc("你好")));
//    }
//}
